package com.bp.hearthealth.pulse.lnapps.bp_view

/**
 * @author isnoam
 * @package_name CardPageTransformer
 * @description：
 */
import android.view.View
import androidx.viewpager.widget.ViewPager
class BPCardPageTransformer : ViewPager.PageTransformer {

    override fun transformPage(page: View, position: Float) {
        val absPosition = Math.abs(position)

        if (absPosition >= 1) {
            // Page is not visible, reset the view
            page.alpha = 1f
            page.rotationY = 0f
        } else {
            // Calculate the degree of rotation based on the position
            val rotation = 180 * position
            page.alpha = 1 - absPosition
            page.pivotY = page.height.toFloat() / 2
            page.rotationY = rotation
        }
    }
}
